package com.always.electrical.energy.utils;

import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;

import java.nio.file.Paths;

public class CodeGenerator {

    public static void main(String[] args) {

        FastAutoGenerator.create("jdbc:postgresql://114.55.62.78:5432/postgres", "yy_test_user", "Yy@test123456.")
                .globalConfig(builder -> builder
                        .outputDir(Paths.get(System.getProperty("user.dir")) + "/src/main/java")
                        .commentDate("yyyy-MM-dd")
                )
                .packageConfig(builder -> builder
                        .parent("com.always.data").entity("entity").mapper("mapper").xml("mapper.xml")
                )
                .strategyConfig(builder ->
                        builder.addInclude("") // 设置需要生成的表名
                )
                .templateEngine(new FreemarkerTemplateEngine())
                .execute();

    }
}
